home *** CD-ROM | disk | FTP | other *** search
/ Best of www.BestZips.com (Collector's Edition) / Best of WWW.BESTZIPS.COM Collector's Edition (JCSM Shareware) (JCS Marketing).ISO / editors_ / ze16v250.zip / ZEUS.ZM_ / ZEUS.ZM
Text File  |  1996-12-12  |  2KB  |  106 lines

  1. //-- Example Macro Script
  2. //-- Description: Typical Zeus macro script
  3. //-- Author: Jussi Jumppanen
  4.  
  5. int ZeusMacro(void)
  6. {
  7.    FileNew();
  8.    set_file_name("new.txt");
  9.  
  10.    put_string("************** Start of the first pass ************");
  11.    EnterLine();
  12.  
  13.    //-- notice that tags work within the Zeus macro intepreter
  14.    put_string("Current File Details Extracted Using Tags");
  15.    EnterLine();
  16.    put_string("-----------------------------------------");
  17.    EnterLine();
  18.    put_string("Drive: '%s' Dir: '%s' File: '%s'", "$FDR", "$FD", "$F");
  19.    EnterLine();
  20.  
  21.    //-- get the current directory and insert it into the document
  22.    string strTest;
  23.    getcwd(strTest);
  24.    put_string("Current Directory is: '%s'", strTest);
  25.    EnterLine();
  26.  
  27.    //-- get some user input
  28.    string szFind1;
  29.    string szPrompt1 = "Find text:";
  30.    string szFind2;
  31.    string szPrompt2 = "Replace text:";
  32.    user_input(szPrompt1, szFind1, szPrompt2, szFind2);
  33.  
  34.    //-- this is what was supplied
  35.    put_string(szPrompt1);
  36.    put_string(szFind1);
  37.    EnterLine();
  38.    put_string(szPrompt2);
  39.    put_string(szFind2);
  40.    EnterLine();
  41.    put_string("************** End of the first pass **************");
  42.  
  43.    //-- now read the file back in
  44.    FileSave();
  45.    EnterLine();
  46.    EnterLine();
  47.    put_string("************** Start of the read back *************");
  48.    EnterLine();
  49.    EnterLine();
  50.    read_file("$FN");
  51.  
  52.    //-- they will now appear in the search/replace dialog boxes
  53.    set_find_text(szFind1);
  54.    set_replace_text(szFind2);
  55.  
  56.    //-- these are the spawn flag values
  57.    SAVE_DOCUMENT    =  1;
  58.    CAPTURE_OUTPUT   =  2;
  59.    CAPTURE_ERROR    =  4;  
  60.    ASKFOR_ARGUMENTS =  8;
  61.    DOS_COMMAND      = 16;
  62.  
  63.    //-- the can be combined to control the spawn session
  64.    sFlags = DOS_COMMAND & CAPTURE_OUTPUT;
  65.  
  66.    spawn("fgrep BOOL z*.zpp", 0, sFlags);
  67.  
  68.    char chTest   = 'c';
  69.    int  sTest    = 66;
  70.    string szTest = "test";
  71.  
  72.    put_string("Character test: ");
  73.    put_char(chTest);
  74.    Enter();
  75.  
  76.    put_string("Integer test: ");
  77.    put_number(sTest);
  78.    Enter();
  79.  
  80.    put_string("String test: ");
  81.    put_string(szTest);
  82.    Enter();
  83.  
  84.    get_column_pos(sColumn);
  85.    get_line_pos(sLine);
  86.  
  87.    put_string("Line test: ");
  88.    put_number(sLine);
  89.    Enter();
  90.  
  91.    put_string("Column test: ");
  92.    put_number(sColumn);
  93.    Enter();
  94.  
  95.    sCount = get_line_count();
  96.  
  97.    put_string("Count test: ");
  98.    put_number(sCount);
  99. }
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.